﻿namespace YnabCsvConverter.Core.Tests
{
   using Converters;
   using NUnit.Framework;

   /// <summary>
   /// Unit Test for the "easybank" converter
   /// </summary>
   [TestFixture]
   public class EasybankTests
   {
      /// <summary>
      /// The subject under test.
      /// </summary>
      private EasybankConverter _sut;

      /// <summary>
      /// Initializes a new instance of the <see cref="EasybankTests" /> class.
      /// </summary>
      public EasybankTests()
      { 
      }

      /// <summary>
      /// Tests the setup.
      /// </summary>
      [TestFixtureSetUp]
      public void TestSetup()
      {
         _sut = new EasybankConverter();
      }

      /// <summary>
      /// Test if a easybank record is converted to a ynab record.
      /// </summary>
      [Test]
      public void ConvertRecord_EasybankRecord_ToYnabRecord()
      {
         // Given
         var easybankRecord = new EasybankRecord
         {
            AccountNumber = "123456789",
            Text = "Income Äther | MEMO",
            DateTime1 = "20.12.2012",
            DateTime2 = "20.12.2012",
            Amount = "-12,34",
            Currency = "EUR"
         };

         // When
         var ynabRecord = _sut.ConvertRecord(easybankRecord);

         // Then
         var expectedYnabRecord = new YnabRecord
         {
            Date = "12/20/2012",
            Payee = "Income Äther ",
            Category = "",
            Memo = " MEMO",
            Outflow = "12.34",
            Inflow = "",
         };

         Assert.That(ynabRecord, Is.EqualTo(expectedYnabRecord));
      }
   }
}
